home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Review 28
/
Creative-Review-CD-ROM-28.iso
/
pc
/
kungfu
/
assets
/
game.dir
/
00043_Script_baddy class
< prev
next >
Wrap
Text File
|
1997-08-08
|
4KB
|
176 lines
-- baddy class method
-- --------------------------------------------------
property ancestor
global gcell
global gplayer
-- ==================================================
-- new method
-- --------------------------------------------------
on new me, props
minit me, props
return me
end mnew
-- ==================================================
-- minit method
-- --------------------------------------------------
on minit me, props
-- put "in minit baddy"
set type = #baddy
set ancestor = new ( script "enemy class" , props )
msetcurrentmove me, ( mkeytomove ( me, #idle ) )
set theloc = getaprop ( props, #loc )
msetloc ( me, theloc)
-- put "out minit baddy"
end minit
-- ==================================================
-- mdispose me
-- --------------------------------------------------
on mdispose me
-- put "in mdispose baddy class"
mdispose ancestor
set ancestor = 0
-- put "in mdispose baddy class"
end mdispose me
-- ==================================================
-- mstart method
-- --------------------------------------------------
on mstart me
-- put "in mstart baddy"
mbatchadd ( gcell, the cell of me, me)
-- put "out mstart baddy"
end mstart
-- ==================================================
-- manimfinish method
-- --------------------------------------------------
on manimfinish me
-- put "in manimfinish baddy "
mmovefinish me
if (the nextmoveflag of me) then
set newmove = (the nextmove of me)
set the nextmoveflag of me = false
else set newmove = mthink ( me )
set newmove = mcheckwalk ( me , newmove)
mmove gsound, the data of me, mmovetokey ( me, newmove )
msetcurrentmove me, newmove
-- put "out manimfinish baddy "
end manimfinish
-- ==================================================
-- mthink method
-- --------------------------------------------------
on mthink me
-- put "in mnewmove baddy "
set newmove = mthink ( ancestor )
if ( newmove = 0 ) then
if ( abs ( the huntvector of me ) = 4 ) then set newmove = ( mattack ( me ) )
else set newmove = mkeytomove ( me , the direction of me )
end if
-- put "out mnewmove baddy "
return newmove
end mthink
-- ==================================================
-- mhurt method
-- --------------------------------------------------
on mhurt me , attackmove, starloc
-- put "in mhurt baddy"
return mcheckhurt ( me , attackmove, starloc )
-- put "out mhurt baddy"
end mhurt
-- ==================================================
-- mhit method
-- --------------------------------------------------
on mhit me, theloc
-- put "in mhit baddy" , theloc
if ilk ( theloc, #point ) then
mhit ( ancestor, theloc )
else mdie me
-- put "out mhit baddy"
end mhit
-- ==================================================
-- mdie method
-- --------------------------------------------------
on mdie me
-- put "in mdie baddy"
mbatchdelete gcell, the cell of me , me
mbaddydead gplayer
set the hideflag of me = true
mreturnthedead gbaddy, me
set the callback of me = false
-- mdispose me
-- put "out mdie baddy"
end mdie
-- ==================================================
-- mstartdie method
-- --------------------------------------------------
on mstartdie me
-- put "in mstartdie baddy"
mbatchdelete gcell, the cell of me , me
-- put "out mstartdie baddy"
end mstartdie